home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Linux
/
Kubuntu 8.10
/
kubuntu-8.10-desktop-i386.iso
/
casper
/
filesystem.squashfs
/
var
/
lib
/
dpkg
/
info
/
cups.preinst
< prev
next >
Wrap
Text File
|
2008-10-20
|
2KB
|
87 lines
#! /bin/sh
# preinst script for cups
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
mv_conffile() {
OLD="$1"
NEW="$2"
PKGNAME="cupsys"
if [ -e "$OLD" ]; then
md5sum=$(md5sum "$OLD" | sed -e 's/ .*//')
old_md5sum=$(dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e "\\' $OLD'{s/ obsolete$//;s/.* //p}")
if [ "$md5sum" = "$old_md5sum" ]; then
echo "Removing obsolete unchanged $OLD..." >&2
rm -f "$OLD"
else
echo "Moving customized $OLD to new location $NEW..." >&2
mv -f "$OLD" "$NEW"
fi
fi
}
case "$1" in
install|upgrade)
if [ -e /var/lib/cups/ppd -a ! -L /var/lib/cups/ppd -a ! -e /etc/cups/ppd ]; then
echo -n "Moving printer definition files..."
mkdir -p /etc/cups/ppd || true
if [ `ls /var/lib/cups/ppd | wc -l` -ne " 0" ]; then
cp -a /var/lib/cups/ppd/* /etc/cups/ppd
fi
rm -rf /var/lib/cups/ppd
echo "done."
fi
if [ -e /var/lib/cups/logs -a ! -L /var/lib/cups/logs ]; then
rmdir /var/lib/cups/logs || true
fi
# Remove dangling pdftops.conf symlink, which is obsolete anyway
if [ -L /etc/cups/pdftops.conf -a ! -e /etc/cups/pdftops.conf ]; then
rm -f /etc/cups/pdftops.conf
fi
# fix 'cupsys' -> 'root' file owner mode transition
if dpkg --compare-versions "$2" lt-nl '1.3.0-3'; then
if [ -d /var/run/cups ]; then
chown -R root /var/run/cups
fi
chown -R root /etc/cups /var/log/cups /var/cache/cups /var/spool/cups
fi
# cupsys -> cups package/file rename
if dpkg --compare-versions "$2" le '1.3.7-7'; then
update-rc.d -f cupsys remove
mv_conffile /etc/default/cupsys /etc/default/cups
mv_conffile /etc/init.d/cupsys /etc/init.d/cups
mv_conffile /etc/pam.d/cupsys /etc/pam.d/cups
mv_conffile /etc/logrotate.d/cupsys /etc/logrotate.d/cups
fi
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 0
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
exit 0